import time
N=5000
def bublesort(massiv,N):
    for i in range(N-1):
        for j in range(N-i-1):
            if massiv[j]>massiv[j+1]:
                massiv[j],massiv[j+1]=massiv[j+1],massiv[j]
def readlist(filename):
    file=open(filename,'r')
    data=file.readlines()
    return data

m1=readlist("m1_sorted.txt")
razmer=len(m1)
t_start=time.time()
bublesort(m1,razmer)
t_finish=time.time()
print("m1_sorted",round((t_finish-t_start)*1000),"milliseconds")
m1=readlist("m2_reverse.txt")
razmer=len(m1)
t_start=time.time()
bublesort(m1,razmer)
t_finish=time.time()
print("m2_reverse",round((t_finish-t_start)*1000),"milliseconds")
m1=readlist("m3_shuffle.txt")
razmer=len(m1)
t_start=time.time()
bublesort(m1,razmer)
t_finish=time.time()
print("m3_shuffle",round((t_finish-t_start)*1000),"milliseconds")
